package com.welsmann.app.start.controller;

import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.welsmann.app.start.common.StartUtil;

@Controller
@RequestMapping("tools")
public class ToolsController extends BaseController{

	@RequestMapping("uuid")
	public String toUUID() {
		return "uuid";
	}
	
	@RequestMapping(value = "uuid/generate", method = RequestMethod.POST)
	public @ResponseBody String generateUUID(@RequestParam(value="uuidNum") int uuidNum, @RequestParam(value="upper") int upper, @RequestParam(value="dash") int dash) {
		String uuid = "";
		for (int i = 0; i < uuidNum; i ++) {
			uuid += "," + StartUtil.formatUUID(UUID.randomUUID().toString(), upper, dash);
		}
		return uuid.substring(1);
	}
}
